package org.jeecg.modules.online.cgform.enums;

/**
 * 数据库类型  对应存储值
 */
public enum DataBaseEnum {

    MYSQL("MYSQL", "1"),
    ORACLE("ORACLE", "2"),
    SQLSERVER("SQLSERVER", "3"),
    POSTGRESQL("POSTGRESQL", "4");

    DataBaseEnum(String name,String value){
        this.name = name;
        this.value = value;
    }

    private String name;

    private String value;

    /**
     * 根据数据库存储的类型值获取真实的名字 默认返回mysql
     * @param value
     * @return
     */
    public static String getDataBaseNameByValue(String value){
        for (DataBaseEnum e : DataBaseEnum.values()) {
            if(e.value.equals(value)){
                return e.name;
            }
        }
        return MYSQL.name;
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}
